$.reboot = function reboot(sn) {
    let sns = [];
    if (sn != undefined) {
        sns.push(sn);
    } else {
        let $checkbox = $("tbody").find("input[type='checkbox']");
        $checkbox.each(function(index, item) {
            if ($(this).is(':checked')) {
                sns.push($(this).val());
            }
        });
    }
    if (sns.length == 0) {
        $.msg({
            title: "重启失败",
            message: "请选择至少一台设备"
        });
        return;
    }
    $.confirm({
        title: "重启设备",
        message: "确定是否重启设备？",
        confirm: function(res) {
            $.myAjax({
                url: "device/reboot.do",
                dataType: "json",
                contentType: "application/json",
                data: JSON.stringify({
                    sns: sns
                }),
                success: function(res) {
                    var table = $(".table").DataTable();
                    table.draw();
                }
            });
        }
    });
}

$.configDevice = function configDevice(sn) {
    $.myAjax({
        url: "device/configDevice.do",
        dataType: "json",
        contentType: "application/json",
        data: JSON.stringify({
            sn: sn,
            aliasName: "test"
        }),
        success: function(res) {
            // var table = $(".table").DataTable();
            // table.draw();
        }
    });
}
